<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增薪资结构')" />

    <th:block th:include="include :: datetimepicker-css" />
</head>
<style>
    .salary {
        position: relative;
        min-height: 1px;
        padding-right: 0px;
        padding-left: 0px;
        width: 19.666667%;;
        float: left;
    }
    .salary > label.error {
        margin-top: 12px;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-salaryStructure-add">
        <div class="form-group col-sm-12">
            <h3>薪资结构</h3>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">员工：</label>
            <div class="col-sm-8">
                <div class='input-group'>
                    <input class='form-control' type='hidden' name="empId" id='empId' required>
                    <input class='form-control' type='text'  id='userAuditName' readonly="readonly" required>
                    <span class='input-group-addon input-sm' onclick='selectDictTree("", this)'>
                                <i class='fa fa-search'>选择</i>
                            </span>
                </div>
            </div>
        </div>

        <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label is-required">薪资调整时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="adjustDate" id="adjustDateNew"  class="form-control" placeholder="yyyy-MM-dd" readonly="readonly" type="text" required>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label is-required">薪酬等级：</label>
            <div class="col-sm-8">
                <input name="payGrade" class="form-control" maxlength="10" type="text" required>
            </div>
        </div>

        <div class="form-group col-sm-12" style="width: 90%;margin-left: 12%;">
            <div class="col-sm-2 salary">
                <label class=" control-label is-required">当月固定工资：</label>
                <input name="comprehensive" id="comprehensiveNew" class="form-control" type="number" maxlength="10" required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">基本工资：</label>
                <input name="basic" class="form-control salaryAdd2"  type="number" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">加班费：</label>
                <input name="overtimePay"  class="form-control salaryAdd2"  type="number" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">绩效工资基数：</label>
                <input name="performanceBonus"  class="form-control salaryAdd2"  type="number" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">岗位补贴：</label>
                <input name="allowance" class="form-control salaryAdd2"  type="number" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">其他补贴：</label>
                <input name="otherSubsidies" class="form-control salaryAdd2"  type="number" maxlength="10"  required>
            </div>

           <!-- <div class="col-sm-2 salary">
                <label class=" control-label is-required">伙食补贴：</label>
                <input name="foodAllowance" class="form-control salaryAdd2"  type="text" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">住宿补贴：</label>
                <input name="accommodationSubsidy" class="form-control salaryAdd2"  type="text" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">高温补贴：</label>
                <input name="highSubsidy" class="form-control salaryAdd2"  type="text" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">加班补贴：</label>
                <input name="overtimeAllowance" class="form-control salaryAdd2"  type="text" maxlength="10"  required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">夜班补贴：</label>
                <input name="nightAllowance" class="form-control salaryAdd2"  type="text" maxlength="10" required>
            </div>

            <div class="col-sm-2 salary">
                <label class=" control-label is-required">全勤奖：</label>
                <input name="attendanceBonus" class="form-control salaryAdd2"  type="text" maxlength="10"  required>
            </div>-->
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">调薪情况：</label>
            <div class="col-sm-8">
                <textarea name="salaryContent" class="form-control"  required></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />

<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var prefix = ctx + "hr/salaryStructure"
    $("#form-salaryStructure-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-salaryStructure-add').serialize());
        }
    }

    $("#adjustDateNew").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

   /* $(".salaryAdd2").on("change",function () {
        let count = 0;
        $(".salaryAdd2").each(function (index, item) {
            count +=  item.valueAsNumber ? item.valueAsNumber : 0;
        })
        $("#comprehensiveNew").val(count);
    });*/

    function selectDictTree(columnId, obj) {
        // var dictType = $.common.nullToStr($(obj).parent().find("input").val());
        var url = ctx + "system/user/selectUserTree";
        var options = {
            title: '选择审核人',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        // debugger
        var body = layer.getChildFrame('body', index);
        var userId = body.find('#userId').val();
        var userNameShow = body.find('#userNameShow').val();
        layer.close(index);
        $("#empId").val(userId);
        $("#userAuditName").val(userNameShow);
        // document.getElementById("userName").value=userName;
    }
</script>
</body>
</html>